package com.caigou.service.impl;

import com.caigou.config.WxMpProperties;
import com.caigou.service.AuthService;
import me.zhyd.oauth.config.AuthConfig;
import me.zhyd.oauth.request.AuthRequest;
import me.zhyd.oauth.request.AuthWeChatOpenRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class AuthServiceImpl implements AuthService {
    @Resource
    private  WxMpProperties properties;

    @Override
    public AuthRequest getWxAuthSignInService() {
        return new AuthWeChatOpenRequest(AuthConfig.builder()
                .clientId(properties.getAppId())
                .clientSecret(properties.getSecret())
                .redirectUri(properties.getAuthorizeUrl())
                .build());
    }
}
